/**
 * <copyright>
 * </copyright>
 *
 */
package de.sabram.upb.specs.map.impl;

import de.sabram.upb.specs.con.ConPackage;

import de.sabram.upb.specs.map.Element;
import de.sabram.upb.specs.map.Ident;
import de.sabram.upb.specs.map.MapFactory;
import de.sabram.upb.specs.map.MapPackage;
import de.sabram.upb.specs.map.Members;
import de.sabram.upb.specs.map.Rule;
import de.sabram.upb.specs.map.RuleMapping;
import de.sabram.upb.specs.map.RuleName;
import de.sabram.upb.specs.map.SymbolMapping;
import de.sabram.upb.specs.map.TypeMapFile;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

import org.eclipse.emf.ecore.impl.EPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class MapPackageImpl extends EPackageImpl implements MapPackage
{
  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass typeMapFileEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass symbolMappingEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass membersEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass ruleMappingEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass ruleEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass rhsEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass elementEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass ruleNameEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass identEClass = null;

  /**
   * Creates an instance of the model <b>Package</b>, registered with
   * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
   * package URI value.
   * <p>Note: the correct way to create the package is via the static
   * factory method {@link #init init()}, which also performs
   * initialization of the package, or returns the registered package,
   * if one already exists.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see org.eclipse.emf.ecore.EPackage.Registry
   * @see de.sabram.upb.specs.map.MapPackage#eNS_URI
   * @see #init()
   * @generated
   */
  private MapPackageImpl()
  {
    super(eNS_URI, MapFactory.eINSTANCE);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private static boolean isInited = false;

  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
   * 
   * <p>This method is used to initialize {@link MapPackage#eINSTANCE} when that field is accessed.
   * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static MapPackage init()
  {
    if (isInited) return (MapPackage)EPackage.Registry.INSTANCE.getEPackage(MapPackage.eNS_URI);

    // Obtain or create and register package
    MapPackageImpl theMapPackage = (MapPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof MapPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new MapPackageImpl());

    isInited = true;

    // Initialize simple dependencies
    ConPackage.eINSTANCE.eClass();

    // Create package meta-data objects
    theMapPackage.createPackageContents();

    // Initialize created meta-data
    theMapPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theMapPackage.freeze();

  
    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(MapPackage.eNS_URI, theMapPackage);
    return theMapPackage;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getTypeMapFile()
  {
    return typeMapFileEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getTypeMapFile_SymbolMappings()
  {
    return (EReference)typeMapFileEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getTypeMapFile_Rulemapping()
  {
    return (EReference)typeMapFileEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getSymbolMapping()
  {
    return symbolMappingEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getMembers()
  {
    return membersEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getMembers_Idents()
  {
    return (EReference)membersEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getRuleMapping()
  {
    return ruleMappingEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getRule()
  {
    return ruleEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getRHS()
  {
    return rhsEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getRHS_Elemnts()
  {
    return (EReference)rhsEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getElement()
  {
    return elementEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getRuleName()
  {
    return ruleNameEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getIdent()
  {
    return identEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getIdent_Members()
  {
    return (EReference)identEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getIdent_Rhs()
  {
    return (EReference)identEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getIdent_Ref()
  {
    return (EReference)identEClass.getEStructuralFeatures().get(2);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public MapFactory getMapFactory()
  {
    return (MapFactory)getEFactoryInstance();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private boolean isCreated = false;

  /**
   * Creates the meta-model objects for the package.  This method is
   * guarded to have no affect on any invocation but its first.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void createPackageContents()
  {
    if (isCreated) return;
    isCreated = true;

    // Create classes and their features
    typeMapFileEClass = createEClass(TYPE_MAP_FILE);
    createEReference(typeMapFileEClass, TYPE_MAP_FILE__SYMBOL_MAPPINGS);
    createEReference(typeMapFileEClass, TYPE_MAP_FILE__RULEMAPPING);

    symbolMappingEClass = createEClass(SYMBOL_MAPPING);

    membersEClass = createEClass(MEMBERS);
    createEReference(membersEClass, MEMBERS__IDENTS);

    ruleMappingEClass = createEClass(RULE_MAPPING);

    ruleEClass = createEClass(RULE);

    rhsEClass = createEClass(RHS);
    createEReference(rhsEClass, RHS__ELEMNTS);

    elementEClass = createEClass(ELEMENT);

    ruleNameEClass = createEClass(RULE_NAME);

    identEClass = createEClass(IDENT);
    createEReference(identEClass, IDENT__MEMBERS);
    createEReference(identEClass, IDENT__RHS);
    createEReference(identEClass, IDENT__REF);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private boolean isInitialized = false;

  /**
   * Complete the initialization of the package and its meta-model.  This
   * method is guarded to have no affect on any invocation but its first.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void initializePackageContents()
  {
    if (isInitialized) return;
    isInitialized = true;

    // Initialize package
    setName(eNAME);
    setNsPrefix(eNS_PREFIX);
    setNsURI(eNS_URI);

    // Obtain other dependent packages
    ConPackage theConPackage = (ConPackage)EPackage.Registry.INSTANCE.getEPackage(ConPackage.eNS_URI);

    // Create type parameters

    // Set bounds for type parameters

    // Add supertypes to classes
    ruleEClass.getESuperTypes().add(this.getRuleMapping());
    ruleNameEClass.getESuperTypes().add(this.getRuleMapping());
    identEClass.getESuperTypes().add(this.getSymbolMapping());
    identEClass.getESuperTypes().add(this.getRule());
    identEClass.getESuperTypes().add(this.getElement());
    identEClass.getESuperTypes().add(this.getRuleName());

    // Initialize classes and features; add operations and parameters
    initEClass(typeMapFileEClass, TypeMapFile.class, "TypeMapFile", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getTypeMapFile_SymbolMappings(), this.getSymbolMapping(), null, "symbolMappings", null, 0, -1, TypeMapFile.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getTypeMapFile_Rulemapping(), this.getRuleMapping(), null, "rulemapping", null, 0, -1, TypeMapFile.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(symbolMappingEClass, SymbolMapping.class, "SymbolMapping", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

    initEClass(membersEClass, Members.class, "Members", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getMembers_Idents(), this.getIdent(), null, "idents", null, 0, -1, Members.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(ruleMappingEClass, RuleMapping.class, "RuleMapping", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

    initEClass(ruleEClass, Rule.class, "Rule", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

    initEClass(rhsEClass, de.sabram.upb.specs.map.RHS.class, "RHS", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getRHS_Elemnts(), this.getElement(), null, "elemnts", null, 0, -1, de.sabram.upb.specs.map.RHS.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(elementEClass, Element.class, "Element", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

    initEClass(ruleNameEClass, RuleName.class, "RuleName", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

    initEClass(identEClass, Ident.class, "Ident", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getIdent_Members(), this.getMembers(), null, "members", null, 0, -1, Ident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getIdent_Rhs(), this.getRHS(), null, "rhs", null, 0, 1, Ident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getIdent_Ref(), theConPackage.getNonTerminal(), null, "ref", null, 0, 1, Ident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    // Create resource
    createResource(eNS_URI);
  }

} //MapPackageImpl
